package com.nidu.demo.menu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nidu.demo.menu.mapper.dataobject.MenuDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper extends BaseMapper<MenuDO> {

    @Select("SELECT * FROM sys_menu WHERE name = #{name} LIMIT 1")
    MenuDO selectByName(String name);

    @Select("SELECT * FROM sys_menu WHERE parent_id = #{parentId} ORDER BY sort_order")
    List<MenuDO> selectByParentId(Long parentId);
}